﻿namespace JobButenko.Models
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    using JobButenko.Models.BusinessLogicLayer;

    [Serializable]
    public class PostModel
    {
        public int PostId { get; set; }

        public string PostName { get; set; }

        public static List<PostModel> GetPositions(int profFieldId)
        {
            var dataManager = new DataManager();
            var list = profFieldId == 1 ? dataManager.Post.GetPost() : dataManager.Post.GetPostId(profFieldId);
            var positionList =
                list.Select(item => new PostModel { PostId = item.PostId, PostName = item.PostName }).ToList();
            return positionList;
        }
    }
}